<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 公司信息数据表
 *
 * Date: 19/03/2018
 * @author George
 */
class CreateCompaniesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('companies', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title')->unique()->comment('名称');
            $table->string('legal')->comment('法人代表');
            $table->string('city')->index()->comment('城市');
            $table->string('address')->nullable()->comment('地址');
            $table->string('telephone')->nullable()->comment('电话');
            $table->string('email')->nullable()->comment('邮箱');
            $table->string('certificate')->comment('营业执照');
            $table->text('introduction')->nullable()->comment('简介');
            $table->string('status', 8)->default('pending')->comment('状态');
            $table->unsignedInteger('creator_id')->index()->comment('创建者ID');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('companies');
    }
}
